﻿<?php

// no direct access
defined('_JEXEC') or die('Restricted access');

// Import Joomla! libraries
jimport('joomla.application.component.model');

require_once JPATH_ADMINISTRATOR.DS.'components'.DS.'com_eventcalendar'.DS.'helpers'.DS.'database.php';

class EventcalendarsModelEvent extends JModel 
{
    function __construct() 
	{
		parent::__construct();
		$this->alustaDb();
    }

	  var $_data;
	  
	 function alustaDb()
	{
		$joku = new DatabaseHelper();
		$option = $joku->get('option');
		
		$db = & JDatabase::getInstance( $option );
		$this->setDBO($db);
	}
 
    /**
     * Returns the query
     * @return string The query to be used to retrieve the rows from the database
     */
    function _buildQuery()
    {
        $query = ' SELECT * '
            . ' FROM #__tapahtuma'
        ;
        return $query;
    }
 
    
    function getData()
    {
        // Lets load the data if it doesn't already exist
        if (empty( $this->_data ))
        {
            $query = $this->_buildQuery();
            $this->_data = $this->_getList( $query );
        }
 
        return $this->_data;
    }

	
	
}


?>